/**
 * 
 */
package com.sx.article.dao.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.sx.article.dao.ITitleInfoDao;
import com.sx.article.entity.TitleEntity;
import com.sx.core.BaseDao;


/**
 * @author Administrator
 *
 */
public class TitleInfoDao extends BaseDao implements ITitleInfoDao {
	private Log log = LogFactory.getLog(this.getClass());

	/* (non-Javadoc)
	 * @see com.sx.article.dao.ITitleInfoDao#deleteTitleByArticleId(java.lang.Integer)
	 */
	public boolean deleteTitleByArticleId(Integer aid) {
		boolean flag = false;
		try {
			flag = super.delInfo(aid, "ArticleTitle.deleteTitleByArticleId");
			flag = true;
		} catch (Exception e) {
			log.error("删除文章与标题关联数据信息",e);
			// TODO: handle exception
		}
		return flag;
	}

	public Integer addTitleInfo(TitleEntity title) {
		Integer id = null;
		try {
			id = super.addInfo(title, "ArticleTitle.addTitleInfo");
		} catch (Exception e) {
			log.error("新增文章数据信息",e);
			// TODO: handle exception
		}
		return id;
	}

	public boolean deleteTitleInfo(TitleEntity title) {
		boolean flag = false;
		try {
			flag = super.delInfo(title, "ArticleTitle.deleteTitleInfo");
		} catch (Exception e) {
			log.error("新增文章数据信息",e);
			// TODO: handle exception
		}
		return flag;
	}

	public List<TitleEntity> findTitleEntityInfo(TitleEntity title) {
		List<TitleEntity> list = null;
		try {
			list = super.getSqlMapClientTemplate().queryForList("ArticleTitle.findTitleInfo",title);
		} catch (Exception e) {
			log.error("查询我的表单信息列表",e);
			// TODO: handle exception
		}
		return list;
	}

	public String findTitleEntityInfoCount(TitleEntity title) {
		String counts = null;
		try {
			counts = (String)super.getSqlMapClientTemplate().queryForObject("ArticleTitle.findTitleInfoCount",title);
		} catch (Exception e) {
			log.error("查询我的表单信息列表的数量",e);
			// TODO: handle exception
		}
		return counts;
	}

	public boolean updateTitleInfo(TitleEntity title) {
		boolean flag = false;
		try {
			flag = super.updateInfo(title, "ArticleTitle.updateTitleInfo");
		} catch (Exception e) {
			log.error("新增文章数据信息",e);
			// TODO: handle exception
		}
		return flag;
	}
	

}
